<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="include :: header('远程踏勘')"/>

    <style>
        body {
            margin: 0px;
            padding: 0px;
        }

        .tab {
            width: 100%;
            height: 100%;
            /* 设置背景颜色，背景图加载过程中会显示背景色 */

        }

        #mainTab {
            /* 加载背景图 */
            background-image: url(images/bg.jpg);
            /* 背景图垂直、水平均居中 */
            background-position: center center;
            /* 背景图不平铺 */
            /*background-repeat: no-repeat;*/
            /* 当内容高度大于图片高度时，背景图像的位置相对于viewport固定 */
            background-attachment: fixed;
            /* 让背景图基于容器大小伸缩 */
            background-size: 100% 100%;

        }

        .loginInfo {
            padding-top: 50px;
        }

        .userId {
            color: white;
            text-align: center;
            font-size: 16px;
        }

        .backButton {
            padding: 20px 0px 0px 0px;
            text-align: center;
            font-size: 20px;
            width: 200px;
            height: 50px;
            background-color: black;
            color: white;
            cursor: pointer;
        }

        .contentcontent {
            background-color: #67CF22;
        }

        .topic {
            border-radius: 20px;
            margin: 30px auto 30px auto;
            padding: 20px 0px 0px 0px;
            text-align: center;
            font-size: 20px;
            color: white;
            width: 400px;
            height: 50px;
            background-color: #3dc25a;
            cursor: pointer;
        }

        .logintopic {
            margin: 5px auto 5px auto;
            padding: 0px 0px 0px 0px;
            text-align: center;
            font-size: 20px;
            color: white;
            width: 50px;
            height: 30px;
            background-color: #B22222;
            cursor: pointer;
        }

        .button2 {
            height: 30px;
            background-color: transparent;
            text-align: center;
            line-height: 30px;
            cursor: pointer;
            border: inset;
            border-width: 1px;
            border-color: transparent;
            border-bottom-color: #e5e5ce;
        }

        .left {
            float: right;
            width: 8%;
            /*height: 100%;*/
            margin-right: 10px;
            background-color: #ffffff;
        }

        .left .backButton {
            width: 100%;
        }

        .right {
            float: left;
            width: 90%;
            height: 100%;
            margin: 10px;
            background-color: #f9f9f9;
        }

        .title {
            padding: 20px 0px 0px 0px;
            text-align: center;
            font-size: 20px;
            width: 100%;
            height: 50px;
            background-color: #464646;
            color: #ffffff;
        }

        .messageButton {
            position: absolute;
            right: 20px;
            bottom: 20px;
            width: 100px;
            height: 100px;
            margin: auto;
            z-index: 1;
        / / background-color: red;
        }

        #videoMeetingZone {
            width: 100%;
            margin: 0px auto 0px auto;
            background-color: #464646;
        }

        .msgBubble {
            text-align: left;
            word-wrap: break-word;
            -moz-border-radius: 10px;
            -webkit-border-radius: 10px;
            border-radius: 10px;
            padding: 5px;
            margin: 5px auto 5px auto;
        }

        .circle {
            border-radius: 50%;
            -moz-border-radius: 50%;
            -webkit-border-radius: 50%;
            text-align: center;
            font-size: 20px;
        }

        .videoToolBar {
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            width: 100%;
            height: 30px;
            line-height: 30px;
        }

        .videoToolBarIcon {
            display: inline-block;
            width: 18px;
            height: 18px;
            margin-top: 6px;
            background-position: center center;
            background-size: 18px 18px;
            background-repeat: no-repeat;
            cursor: pointer;
        }

        button[disabled] {
            color: #ccc;
        }

        button[disabled]:hover {
            background-color: #d84a38;
        }

        #videoBox {
            float: left;
            width: 33%;
            height: 97.2%;
            margin: 2%;
            /*background: #fff;*/
            background: #4e4a4a;
        }

        #voipBigVideo {
            width: 100%;
            height: 96% !important;
        }

        .iCheck-helper {
            position: absolute;
            top: 0%;
            left: 0%;
            display: block;
            width: 100%;
            height: 100%;
            margin: 0px;
            padding: 0px;
            background: rgb(255, 255, 255);
            border: 0px;
            opacity: 0;
        }

        .form-group label {
            width: 93px;
            padding-right: 0px;
        }

        .form-group div {

            padding-left: 0px;
        }

        #star table td {
            border: 1px solid #dde2e4;
        }


    </style>

    <link rel="stylesheet" type="text/css" href="../../starcss/effect.css">
    <link rel="stylesheet" type="text/css" href="../../jquery-ui.min.css">
    <script type="text/javascript" src="../../js1/adapter-latest.js"></script>
    <!--	<script type="text/javascript" src="../../jquery-3.2.1.min.js"></script>-->
    <script type="text/javascript" src="/yyqhstyle/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../../jquery-ui.min.js"></script>
    <script type="text/javascript" src="../../msg_box_plugin.js"></script>
    <script type="text/javascript" src="/sdk/star_rtc_video.min.js"></script>
    <script type="text/javascript" src="../../sdk/star_rtc_lib.min.js"></script>
    <script type="text/javascript" src="../../cookie_tools.js"></script>
    <script type="text/javascript" src="../../index.js"></script>

    <!--================================================================-->

    <link rel="icon" sizes="192x192" href="../../images/webrtc-icon-192x192.png">
    <link href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="../../css1/main.css">
    <script src="../../js1/main.js" async></script>
    <script type="text/javascript" src="../../ga.js"></script>

</head>

<body>

<input type="hidden" name="uuid" id="uuid" th:value="*{uuid}"/>
<input type="hidden" name="user" id="user" th:value="*{user}"/>
<input type="hidden" name="phone" id="phone" th:value="*{sfzCard}"/>
<input type="hidden" id="username" name="username" th:value="${username}">
<input type="hidden" id="makeTime" name="makeTime" th:value="${makeTime}">
<input type="hidden" id="date" name="date" th:value="${date}">
<input type="hidden" id="isfinish" name="isfinish" th:value="${isfinish}">
<input type="hidden" id="qyName" name="qyName" th:value="${qyName}">

<div id="voipTab" class="tab" style="display:none">
    <div id="voipCallDlg" title="发送1对1远程踏勘视频申请">
        <!--			-->
        <p class="validateTips">向用户：<span id="calleeId"></span>发起1对1远程踏勘视频申请.</p>
        <div style="margin-top:10px">
            <input type="checkbox" id="voipTypeAudioOnly"><label for="voipTypeAudioOnly">仅音频</label>
        </div>
    </div>
    <div id="voipResponseDlg" title="收到1对1远程视频踏勘申请">
        <p class="validateTips">收到来自用户：<span id="callerId"></span>的远程视频踏勘申请.</p>
    </div>
    <div id="voipConnectDlg" title="正在呼叫用户">
        <div class="validateTips">
            <div class="spinner" style="width:100px;margin-top:10px;">
                <div class="rect1" style="margin-left:5px;"></div>
                <div class="rect2" style="margin-left:5px;"></div>
                <div class="rect3" style="margin-left:5px;"></div>
                <div class="rect4" style="margin-left:5px;"></div>
                <div class="rect5" style="margin-left:5px;"></div>
            </div>
        </div>
    </div>

    <div class="right">
        <!--			<div id="voipTargetIdInputWrapper" class="title" style="height:70px;padding:0px;">-->
        <input id="targetUserId"
               style="width: 100%;height: 100%;background: whitesmoke;padding: 0;border-width: 0;text-align: center"
               th:value="*{sfzCard}" type="hidden"/>
        <div id="voipZone" style="width:100%;height:100%">
            <div id="voipVideoZone" style="width:100%;height:100%">
                <div class="" style="width:100%;height:100%;position:relative;">
                    <div id="voipCanvas"
                         style="width:100%;height:100%;z-index=1;position:absolute;top:0px;left:0px;">
                        <canvas id="voipMyCanvas" style="height:100%">
                        </canvas>
                    </div>
                    <video id="voipSmallVideo" muted
                           style="width:21%;max-height:100%;float:left;background:#fff;margin:1%; display:none"></video>
                    <div id="videoBox">
                        <div class="wjr" style="text-align: center;font-size: 4rem;padding-top: 60%;color: white;">
                            踏勘人员暂未接入此任务...
                        </div>
                        <video id="voipBigVideo" style=""></video>
                        <!--							<img  src="/images/dw.png" width="30px;" style="float:left;"/>-->

                        <!--							<span id="site" style="color:#fff;line-height:30px;"></span>-->

                        <!--							<span  id="name" ></span>-->
                    </div>
                    <!--						<div  id="iddiv1"  style="position: absolute;bottom: 15px;right: 15px;z-index: 999999;display:none">-->
                    <button style="display:none" id="start">开始</button>
                    <!--							<button id="record" disabled>开始录制</button>-->
                    <!--							<button id="play" disabled>播放</button>-->
                    <!--							<button id="download" disabled>上传</button>-->
                    <!--						</div>-->
                    <div style="width:63%;float:right;height:100%;padding:2% 2% 2% 0;">
                        <div class="tabs-container">
                            <ul class="nav nav-tabs">
                                <li class="active"><a data-toggle="tab" href="#tab-1">基本信息</a>
                                </li>
                                <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">审批细则</a>
                                </li>
                            </ul>
                            <div class="tab-content" style="height:100%;overflow: auto;">
                                <div id="tab-1" class="tab-pane active">
                                    <div class="panel-body" style="">
                                        <!--											<strong>基本信息</strong>-->
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <div class="col-sm-12">
                                                    <p class="form-control-static"><strong
                                                            th:text="*{username}"></strong></p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <div class="col-sm-12">
                                                    <p class="form-control-static"><span
                                                            style="color: #a29d9d">手机号</span>&nbsp;&nbsp;&nbsp;&nbsp;<strong
                                                            th:text="*{phone}">手机号</strong></p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 form-control-static">办件编号：</label>
                                                <div class="col-sm-10">
                                                    <p class="form-control-static">编号</p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 form-control-static">所属类别：</label>
                                                <div class="col-sm-10">
                                                    <p class="form-control-static">类别</p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 form-control-static">踏勘时间：</label>
                                                <div class="col-sm-10">
                                                    <p class="form-control-static" id="_makeTime"></p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 form-control-static">企业名称：</label>
                                                <div class="col-sm-10">
                                                    <p class="form-control-static" th:text="*{qyName}"></p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 form-control-static">企业地址：</label>
                                                <div class="col-sm-10">
                                                    <p class="form-control-static" th:text="*{qyAddress}"></p>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 form-control-static">踏勘位置：</label>
                                                <div class="col-sm-10">
                                                    <p class="form-control-static" id="openMaps"></p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div id="tab-2" class="tab-pane">
                                    <div class="panel-body" style="height:auto">
                                        <div style="margin-bottom: 3px;" class="col-sm-12">
                                            <select class="form-control" name="" id="tableList">

                                            </select>
                                        </div>
                                        <div id="star">

                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <audio id="voipBigAudio" autoplay style="width:100%;height:100%"/>
                </div>
                <video id="recorded" playsinline loop></video>

                <div id="iddiv2">
                    <p><input type="hidden" id="echoCancellation"></p>
                </div>
            </div>
            <div id="voipMsgWindow" style="width:15%;height:100%;float:right;position:relative;">
            </div>
            <div id="voipMessageButton" class="messageButton" style="display:none">
					<span class="svg-icon flat-line" id="line-email">
						<span class="svg-icon flat-line" id="line-message"><svg class="flat_icon"
                                                                                xmlns="http://www.w3.org/2000/svg"
                                                                                width="100px" height="100px"
                                                                                viewBox="0 0 100 100">
								<path class="circle"
                                      d="M50,2.125c26.441,0,47.875,21.434,47.875,47.875c0,26.441-21.434,47.875-47.875,47.875C17.857,97.875,2.125,76.441,2.125,50C2.125,23.559,23.559,2.125,50,2.125z">
								</path>
								<g class="icon">
									<path class="back"
                                          d="M75.139,28.854h-3.807l-8.125-8.125c-0.381-0.38-0.999-0.382-1.381,0l-8.124,8.125H36.428c-2.79,0-5.05,2.261-5.05,5.048v25.247c0,2.79,2.26,5.051,5.05,5.051h38.711c2.789,0,5.05-2.261,5.05-5.051V33.902C80.188,31.115,77.928,28.854,75.139,28.854z">
									</path>
									<path class="front"
                                          d="M63.571,35.8H24.862c-2.789,0-5.05,2.262-5.05,5.049v25.247c0,2.788,2.261,5.049,5.05,5.049h3.806l8.125,8.125c0.382,0.381,1,0.383,1.381,0l8.125-8.125h17.275c2.788,0,5.05-2.261,5.05-5.049V40.85C68.62,38.062,66.361,35.8,63.571,35.8z">
									</path>
									<path class="dots"
                                          d="M34.743,50.108c-1.858,0-3.365,1.507-3.365,3.366c0,1.86,1.506,3.367,3.365,3.367c1.86,0,3.367-1.507,3.367-3.367C38.109,51.615,36.603,50.108,34.743,50.108z M44.842,50.108c-1.858,0-3.367,1.507-3.367,3.366c0,1.86,1.507,3.367,3.367,3.367c1.859,0,3.366-1.507,3.366-3.367C48.208,51.615,46.701,50.108,44.842,50.108z M54.94,50.108c-1.857,0-3.365,1.507-3.365,3.366c0,1.86,1.506,3.367,3.365,3.367c1.86,0,3.366-1.507,3.366-3.367C58.307,51.615,56.8,50.108,54.94,50.108z">
									</path>
								</g>
							</svg></span>
					</span>
            </div>
        </div>

    </div>
    <div class="left">
        <div id="voipCtrl">
            <div style="width:100%;height:100px;padding-top:25px;">
                <div calss="voipHangup" id="videoClose"
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/images/hangup.jpg);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">关闭踏勘</p>
            </div>


            <div style="width:100%;height:100px;padding-top:25px;">
                <div calss="voipHangup" id="beginV"
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/images/lu.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center" id="btnText">开始录制</p>
            </div>
            <div style="width:100%;height:100px;padding-top:25px; display: none">
                <div calss="voipHangup" id="play" disabled
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/images/stop.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">播放录像</p>
            </div>
            <div style="width:100%;height:100px;padding-top:25px;display: none">
                <div calss="voipHangup" id="download" disabled
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/images/up.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">上传</p>
            </div>
            <div style="width:100%;height:100px;padding-top:25px;">
                <div calss="voipHangup" id="saveTable" disabled
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/img/zg.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">整改保存</p>
            </div>
            <div style="width:100%;height:100px;padding-top:25px;">
                <div calss="voipHangup" id="open2" disabled
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/img/tg.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">通过</p>
            </div>
            <div style="width:100%;height:100px;padding-top:25px;">
                <div calss="voipHangup" id="open3" disabled
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/img/btg.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">不通过</p>
            </div>
            <div style="width:100%;height:100px;padding-top:25px;">
                <div calss="voipHangup" id="open4" disabled
                     style="width:75px;height:75px;margin:0 auto;background-image: url(/img/btg.png);background-size: cover;cursor:pointer;">
                </div>
                <p style="text-align:center">拍照</p>
            </div>
        </div>
    </div>
</div>

<!--  <div th:include="include::footer"></div>-->
<div>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script src="/ajax/libs/blockUI/jquery.blockUI.js"></script>
    <script src="/ajax/libs/iCheck/icheck.min.js"></script>
    <script src="/ajax/libs/layer/layer.min.js"></script>
    <script src="/ajax/libs/layui/layui.js"></script>
    <script src="/ruoyi/js/common.js?v=4.0.0"></script>
    <script src="/ruoyi/js/ry-ui.js?v=4.0.0"></script>
    <script src="/js/jquery.raty.js"></script>
</div>
<script th:inline="javascript">
	// var prefix = ctx + "Rong";
	var uuid = $('#uuid').val()
	var maxCrux = 0; //关键项允许不合符数量
	var maxZd = 0; //重点不符合
	var max = 0; //重点和一般允许不符合总和数量总和
	var options = {
		number: 3,
		readOnly: true,
		score: 3,
		starHalf: '/img/star-half.png',
		starOff: '/img/star-off.png',
		starOn: '/img/star-on.png',
		width: '12%'
	}
	var arr = []

	var time = new Date(Date.parse($("#makeTime").val().replace(/-/g, '/')));
	var d = time.getFullYear() + '年' + (time.getMonth() + 1) + '月' + time.getDate() + '日';
	$("#_makeTime").text(d);

	function tongguo() {
		$.operate.saveTab("Rong/tongguo/" + uuid, $('#form-takan').serialize());
	}

	function butongguo() {
		if ($('#reason').val().length == 0) {
			$.modal.msgError('通过理由不能为空');
			return;
		}
		$.operate.saveTab("Rong/butongguo/" + uuid, $('#form-takan').serialize());
	}

	function show1() {
		var sbtitle = document.getElementById("form-conceal");
		if ($('#btg').is(':checked')) {
			sbtitle.style.display = 'block';
		} else {
			sbtitle.style.display = 'none';
		}
	}

	/**
	 * 关闭视频
	 */
	$("#videoClose").click(function () {
		console.log("close");
		hangupVOIP();
	})


	/**
	 * 获取表单名称列表
	 */
	function getNameList() {
		$.ajax({
			type: "post",
			url: "/Rong/tcTableList",
			success: function (msg) {
				if (msg.code == 0) {
					var str = ""
					$.each(msg.data, function (i, v) {
						str += "<option value='" + v.id + "'>" + v.formname + "</option>";
					})
					$("#tableList").html(str);
					getTableInfo();
				}
			},
			error: function (msg) {
				$.modal.alertError("获取表单列表失败:" + msg)
			}
		})
	}
	selectIsFirst()
	/**
	 * 查询是否已经保存过
	 */
	function selectIsFirst(){
		$.operate.post("/Rong/selectIsFirst",{uuid: uuid},function (msg) {
			if(msg.data.length == 0){
				getNameList()
			}else{
				var dataList = [];
				var index = 0;
				$.each(msg.data,function (i,v) {
					if(v.parentId == null){
						index++;
						dataList.push(v);

					}else{
						if(dataList[index-1].data==null) dataList[index-1].data = []
						dataList[index-1].data.push(v)
					}
				})
				console.log("______________",dataList);
				rend(dataList)
			}
		})
	}



	$("#tableList").change(function () {
		getTableInfo();
	})

	/**
	 * 获取表单详情
	 */
	function getTableInfo(id) {
		$("#tableList").val();
		// $.modal.loading("正在加载表单...");
		$.operate.post("/Rong/tcTableInfo", {
			id: id == null ? $("#tableList").val() : id
		}, function (msg) {
			if (msg.code == 0) {
				rendTable(msg.data)
			}
		})
	}

	function rend(data) {
		var str = '<table class="table table-striped table-hover table-condensed " style="background: white;">' +
				'                <tbody>' +
				'<tr>' +
				'                    <td style="width:8%" >核查内容</td>' +
				'                    <td  style="width:33% !important;">核查和评价方法</td>' +
				'                    <td style="width:6%" >编号</td>' +
				'                    <td >重要性</td>' +
				'                    <td colspan="3" style="width:35%" >结果判定</td>' +
				'                </tr>'

		var len = 1;
		$.each(data, function (i, v) {
			$.each(v.data, function (j, k) {
				str += '<tr lev="'+k.rowLev+'">'
				if (j == 0) {
					str += '                    <td rowspan="' + v.data.length + '">' + v.rowParent + '</td>';
				}
				str += '                    <td>' + k.rowContent + '</td>' +
						'                    <td>' + k.rowId + '</td>' +
						'                    <td class="s' + len + '"></td>' ;

				if(k.rowResult == null){
					str+='                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="0">符合</label></td>' +
							'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="1">不符合</label></td>' +
							'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="2">合理缺项</label></td>';
				}else{
					if(k.rowResult == 0){
						str+='                    <td><label class="radio-inline"><input type="radio" checked="checked" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="0">符合</label></td>' +
								'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="1">不符合</label></td>' +
								'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="2">合理缺项</label></td>';
					}else if(k.rowResult == 1){
						str+='                    <td><label class="radio-inline"><input type="radio"  name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="0">符合</label></td>' +
								'                    <td><label class="radio-inline"><input type="radio" checked="checked" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="1">不符合</label></td>' +
								'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="2">合理缺项</label></td>';
					}else if(k.rowResult == 2){
						str+='                    <td><label class="radio-inline"><input type="radio"  name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="0">符合</label></td>' +
								'                    <td><label class="radio-inline"><input type="radio"  name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="1">不符合</label></td>' +
								'                    <td><label class="radio-inline"><input type="radio" checked="checked" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="2">合理缺项</label></td>';
					}
				}

											'                </tr>';
				arr.push(k.rowLev)
				len++
			})
		})
		str += "</tbody></table>"
		$("#star").html(str);
		getStar(arr, options);
	}

	function rendTable(data) {
		var str = '<table class="table table-striped table-hover table-condensed " style="background: white;">' +
				'                <tbody>' +
				'<tr>' +
				'                    <td style="width:8%" >核查内容</td>' +
				'                    <td  style="width:33% !important;">核查和评价方法</td>' +
				'                    <td style="width:6%" >编号</td>' +
				'                    <td >重要性</td>' +
				'                    <td colspan="3" style="width:35%" >结果判定</td>' +
				'                </tr>'

		var len = 0;
		$.each(data, function (i, v) {
			$.each(v.data, function (j, k) {
				str += '<tr lev="'+k.significance+'">'
				if (j == 0) {
					str += '                    <td rowspan="' + v.data.length + '">' + v.content + '</td>';
				}
				str += '                    <td>' + k.checkevaluate + '</td>' +
						'                    <td>' + k.serialnum + '</td>' +
						'                    <td class="s' + len + '"></td>' +
						'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="0">符合</label></td>' +
						'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="1">不符合</label></td>' +
						'                    <td><label class="radio-inline"><input type="radio" name="op' + arr.length + '" id="inlineRadio' + arr.length + '" value="2">合理缺项</label></td>' +
						'                </tr>';
				arr.push(k.significance)
				len++
			})
		})
		str += "</tbody></table>"
		$("#star").html(str);
		getStar(arr, options);
	}

	/**
	 * 是否全部被点击
	 */
	function isCheckAll() {
		var flg;
		$.each(arr, function (i, v) {
			if ($("input[name=op" + i + "]:checked").length == 0) {
				$.modal.msgWarning("请勾选第" + (i + 1) + "项");
				flg = false;
				return false;
			}
		})
		flg = flg == undefined ? true : flg;
		return flg;
	}

	/**
	 * 是否符合通过条件
	 */
	function isTrue() {
		var t = 0, f = 0, l = 0;
		$.each(arr, function (i, v) {
			switch ($("input[name=op" + i + "]").parents('tr').children('[name=score]').val()) {
				case '1':
					if ($("input[name=op" + i + "]").val() == 1) {
						t++;
					}
					break;
				case '2':
					if ($("input[name=op" + i + "]").val() == 1) {
						f++;
					}
					break;
				case '3':
					if ($("input[name=op" + i + "]").val() == 1) {
						l++;
					}
					break;
				default:
					break;
			}
		})
		if (maxCrux < l) {
			$.modal.alertError("关键项不符合总数必须小于等于" + maxCrux);
			return false;
		}
		if (max < (t + f)) {
			$.modal.alertError("重点项和一般项不符合总数必须小于等于" + max);
			return false;
		}
		if (maxZd < f) {
			$.modal.alertError("重点项不符合总数必须小于等于" + maxZd);
			return false;
		}
	}

	/**
	 * 暂存表单
	 */
	function saveTable() {
		$.modal.confirm("整改保存不会保留您已经录制的视频和照片,如需保存请点确定", function () {
			// if(isCheckAll()){
			var data = [];
			var index = 0;
			$.each(arr, function (i, v) {
				var tr = $("input[name=op" + i + "]").eq(0).parents('tr');
				if (tr.children().length == 7) {
					index++;
					data.push({
						rowParent: tr.children().eq(0).text(),
						oid: $("#uuid").val(),
						data: []
					})
					data[index - 1].data.push({
						rowContent: tr.children().eq(1).text(),
						oid: $("#uuid").val(),
						rowId: tr.children().eq(2).text(),
						rowLev: tr.attr("lev"),
						rowResult: $("input[name=op" + i + "]:checked").val(),
					})

				} else {
					data[index - 1].data.push({
						rowContent: tr.children().eq(0).text(),
						oid: $("#uuid").val(),
						rowId: tr.children().eq(1).text(),
						rowLev: tr.attr("lev"),
						rowResult: $("input[name=op" + i + "]:checked").val(),
					})
				}
			})
			console.log(data);
			sendSaveTable(data, $("#uuid").val());

			// }
		})
	}

	$("#saveTable").click(function () {
		saveTable();
	});

	function sendSaveTable(data, uuid) {
		$.operate.post("/Rong/saveCheck", {"json": JSON.stringify(data), "ud": uuid}, function (msg) {})
	}

	/**
	 * 生成星级
	 */
	function getStar(arr, options) {
		$.each(arr, function (i, v) {
			options.score = v-0;
			$(".s" + i).raty(options);
		})
	}

	/**
	 * 打开地图
	 */
	function openMaps(x, y) {
		layer.open({
			type: 2,
			area: [($(window).width() * 0.8) + 'px', ($(window).height() - 50) + 'px'],
			fix: false,
			//不固定
			maxmin: true,
			shade: 0.3,
			title: "地图",
			content: "/Rong/openMaps?x=" + x + "&y=" + y,
			// btn: ['确定', '关闭'],
			// 弹层外区域关闭
			shadeClose: true,
			// yes: callback,
			cancel: function (index) {
				return true;
			}
		});
	}

	// $("voipBigVideo").drableImage
</script>
</body>
</html>
